|
|
|
|
|
|
|
A point process modifies the values of the pixels in an image one pixel at a time. For each pixel in an image, you examine the pixel's value and compute a new value for the corresponding pixel in the output image. |
|
|
|
|
|
|
|
|
The new value of each pixel does not depend on the values of any other pixels, so you can change the value of the pixel directly in the input image. That means the output image may be in a separate picture box, or it may be in the same picture box as the input image. |
|
|
|
|
|
|
|
|
While point processes are generally quite simple, some produce dramatic results. Using very simple algorithms, you can complement an image or adjust its brightness, color balance, and contrast. |
|
|
|
|
|
|
|
|
In most point processes, the output value of a pixel depends only on the input pixel's value rather than other factors like its position in the image. In that case, all pixels in the image with a certain input value are mapped to the same output value. If you are using a color model that uses palettes, such as 8-bit color, you can use the palette to make point processes much faster. Instead of examining each pixel in the image, you only need to redefine the nonstatic colors in the picture's palette. Redefining 236 palette entries is much faster than modifying the hundreds of thousands of pixels in even a relatively small image. |
|
|
|
|
|
|
|
|
Remapping a color palette in this way is called palette animation. It is one of the few ways in which 8-bit color is superior to color models with greater depth. Although palette animation is fast, it is much more cumbersome. It requires that you handle all the intricacies of palette management. Because it is much easier to understand, the example in this chapter assumes you are using a 24-bit color system. |
|
|
|
|
|
|
|
|
One of the simplest image processing tasks is converting an image from color into shades of gray. There are several reasons you might want to do this. First, grayscale images often look better at lower color resolution than color images do. For example, suppose you want to view an image using 8-bit color. A typical 8-bit color system has only 236 colors available for displaying the image. The image may use far more than 236 colors, so it may look strange with only 236 colors. The system may dither the image using small dots of color to approximate colors it cannot display. This may give it a bumpy texture. |
|
|
|
|
|
|
|
|
On the other hand, grayscale images look fine displayed with 236 shades of gray. If you convert the image into gray scale, the 8-bit color system will produce a smooth result. Of course, at some point you need to load the image in full color so that you can perform an accurate conversion. |
|
|
|
|
|
|
|
|
Another reason for using grayscale images is that they make many image processing operations easier to understand. For example, you can use image processing techniques to enhance edges in an image. Although you can apply these techniques to color images, the results are easier to understand with a grayscale image. |
|
|
|
|
|